
type Recursion = {
    [key: string]: string | Array<Recursion>
}
let dataArray: Array<Recursion> = []
export function recursion(data: Array<Recursion>) {
    data.forEach((item, index) => {
        if (item.children.length > 0) {
            recursion(item.children as Array<Recursion>)
        }
        dataArray.push(item)
    })

    return dataArray
    // clearDataArray()
}
// function clearDataArray() {
//     dataArray = []
// }